package com.dc.designPattern._16_observer.impl;

/**
 * Description: 观察者模式_具体观察者_阿里网站
 * @author: gdc
 * @date: 2021/5/20
 * @version 1.0
 */
public class ALiSite implements Observer {

    /**
     * 温度
     */
    private double wenDu;
    /**
     * 压力
     */
    private double yaLi;
    /**
     * 湿度
     */
    private double shiDu;

    @Override
    public void update(double temperature, double pressure, double humidity) {
        this.wenDu = temperature;
        this.yaLi = pressure;
        this.shiDu = humidity;

        displayInfo();
    }

    /**
     * 显示信息
     */
    private void displayInfo() {
        System.out.println("===阿里网站===");

        System.out.println("***阿里网站 气温: " + wenDu + "***");
        System.out.println("***阿里网站 气压: " + yaLi + "***");
        System.out.println("***阿里网站 湿度: " + shiDu + "***");
    }
}
